package com.amrit.revision;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.sql.RowSet;

public class JDBCTest {
	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		JDBCTest.getConnection();
	}


	public static Connection getConnection() throws SQLException,
	ClassNotFoundException {
		Connection con = null;
		Class.forName("oracle.jdbc.driver.OracleDriver");
		con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","SYS as SYSDBA", "admin");
		return con;
	}

	public void updateData() throws SQLException, ClassNotFoundException {

		Connection con = JDBCTest.getConnection();
		String sql = "";
		Statement s = con.createStatement();
		ResultSet rs1 = s.executeQuery(sql);
		RowSet rs2 = (RowSet)s.executeQuery(sql);

		PreparedStatement ps = con.prepareStatement(sql);
		CallableStatement cs = con.prepareCall(sql);
		cs.executeQuery();
		Statement s1 = con.createStatement();
		ResultSet rs = s1.executeQuery("");
		while(rs.next()){
			System.out.println(rs.next());

		}
		rs.close();
		s.close();
		con.close();
	}
}

